# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-nh3
pkgver=0.2.15
pkgrel=0
pkgdesc="Python bindings to the ammonia HTML sanitization library"
url="https://github.com/messense/nh3"
arch="all"
license="MIT"
makedepends="
	cargo
	py3-gpep517
	py3-maturin
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://pypi.org/packages/source/n/nh3/nh3-$pkgver.tar.gz"
options="net" # Required to download Rust crates
builddir="$srcdir/nh3-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
59aeea5ff5ff86770c38ec0c40390a1b325a8ecceb826abb1006480c1b66f3dbe0aa920f70abca71d4c965026f4b8173beea01eed4491ba4d6ace9c2471bdfef  nh3-0.2.15.tar.gz
"
